package com.shuai.common.constant;

/**
 * 用户等级每日请求上限数
 */
public enum UserLevelLimitEnum {
    ADMIN(0, Integer.MAX_VALUE, "管理员"),
    NORMAL(1, 4000, "普通用户"),
    VIP(2, 10000, "VIP用户"),
    GUEST(3, 10, "游客");

    private final int levelCode;
    private final int limitCount;
    private final String description;

    UserLevelLimitEnum(int levelCode, Integer limitCount, String description) {
        this.levelCode = levelCode;
        this.limitCount = limitCount;
        this.description = description;
    }

    public int getLevelCode() {
        return levelCode;
    }

    public String getDescription() {
        return description;
    }

    public int getLimitCount() {
        return limitCount;
    }

    // Optional: Method to get UserLevel enum from level code
    public static UserLevelLimitEnum fromLevelCode(int levelCode) {
        for (UserLevelLimitEnum level : UserLevelLimitEnum.values()) {
            if (level.getLevelCode() == levelCode) {
                return level;
            }
        }
        throw new IllegalArgumentException("Invalid UserLevel code: " + levelCode);
    }
}
